﻿<Window x:Class="SharpAvi.Sample.SettingsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="SettingsWindow" ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
        Height="300" Width="300" SizeToContent="Height"
        WindowStyle="None" AllowsTransparency="True" Background="White">
    
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    
    <Border BorderBrush="DarkGray" BorderThickness="2"
            SnapsToDevicePixels="True">
        <DockPanel>
            <TextBlock DockPanel.Dock="Top"
                       Background="DarkGray" Foreground="White"
                       HorizontalAlignment="Left" Padding="7,4" MinWidth="150" Margin="0,0,0,7"
                       FontSize="16" FontWeight="SemiBold"
                       Text="Settings"/>
            <StackPanel DockPanel.Dock="Bottom"
                        Orientation="Horizontal" HorizontalAlignment="Center"
                        Margin="7">
                <Button Content="OK" IsDefault="True"
                        Click="OK_Click"/>
                <Button Content="Cancel" IsCancel="True"
                        Margin="7,0,0,0"/>
            </StackPanel>
            <StackPanel Orientation="Vertical"
                        Margin="7,0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">Folder</Label>
                    <DockPanel Grid.Row="0" Grid.Column="1">
                        <Button DockPanel.Dock="Right" MinWidth="0"
                                Click="BrowseFolder_Click">
                            ...
                        </Button>
                        <TextBox IsReadOnly="True"
                                 Text="{Binding Folder, Mode=OneWay}"/>
                    </DockPanel>
                </Grid>
                <Expander Margin="0,7,0,0"
                          Header="Video">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto" MinHeight="7"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">Encoder</Label>
                        <ComboBox Grid.Row="0" Grid.Column="1"
                                  ItemsSource="{Binding AvailableCodecs}"
                                  SelectedValuePath="Codec"
                                  DisplayMemberPath="Name"
                                  SelectedValue="{Binding Encoder, Mode=TwoWay}"/>
                        <TextBlock Grid.Row="1" Grid.Column="1"
                                   TextWrapping="Wrap" Foreground="DarkGray" Margin="0,0,0,7"
                                   Visibility="{Binding Is64BitProcess, Mode=OneTime, Converter={StaticResource VcBool2Vis}}">
                            Switch target platform to 'x86' to use 32-bit VfW codecs.
                        </TextBlock>

                        <Label Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right">Quality</Label>
                        <Slider Grid.Row="2" Grid.Column="1" Orientation="Horizontal" 
                                Minimum="1" Maximum="100" LargeChange="10" SmallChange="1"
                                IsSnapToTickEnabled="True" TickFrequency="1"
                                AutoToolTipPrecision="0" AutoToolTipPlacement="TopLeft"
                                Value="{Binding Quality, Mode=TwoWay}"/>
                    </Grid>
                </Expander>
                <Expander Margin="0,7,0,0"
                          Header="Audio">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="7"/>
                            <RowDefinition/>
                            <RowDefinition Height="7"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>

                        <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">Source</Label>
                        <ComboBox Grid.Row="0" Grid.Column="1"
                                  ItemsSource="{Binding AvailableAudioSources}"
                                  DisplayMemberPath="Value"
                                  SelectedValuePath="Key"
                                  SelectedValue="{Binding SelectedAudioSourceIndex, Mode=TwoWay}"/>
                        
                        <CheckBox Grid.Row="2" Grid.Column="2"
                                  Content="Stereo"
                                  IsChecked="{Binding UseStereo}"/>
                        
                        <Label Grid.Row="4" Grid.Column="0">
                            MP3 Encoding
                        </Label>
                        <StackPanel Grid.Row="4" Grid.Column="1"
                                    Orientation="Horizontal">
                            <CheckBox Name="EncodeAudioBox"
                                      VerticalAlignment="Center"
                                      IsChecked="{Binding EncodeAudio, Mode=TwoWay}"/>
                            <Slider IsEnabled="{Binding ElementName=EncodeAudioBox, Path=IsChecked, Mode=OneWay}"
                                    IsSnapToTickEnabled="True" TickFrequency="1"
                                    SmallChange="1" LargeChange="1"
                                    AutoToolTipPlacement="None"
                                    Minimum="0"
                                    Maximum="{Binding MaximumAudioQuality}"
                                    Value="{Binding AudioQuality}"
                                    Width="100" Margin="7,0"/>
                        </StackPanel>
                    </Grid>
                </Expander>
                <CheckBox Foreground="DarkGray"
                          IsChecked="{Binding MinimizeOnStart, Mode=TwoWay}"
                          Margin="0,7,0,0">
                    Minimize on capture start
                </CheckBox>
            </StackPanel>
        </DockPanel>
    </Border>
</Window>
